<div class="tab">
  <ul class="cards">
    @foreach (IDocument tagDocument in Documents[Blog.Tags]
          .GroupBy(x => x.String(BlogKeys.Tag)).Select(x => x.Where(p => p.Get<int>(Keys.CurrentPage) == 1).First())
          .OrderByDescending(x => x.Get<int>(Keys.TotalItems)))
    { 
      string tagName = tagDocument.String(BlogKeys.Tag);
      string postCount = tagDocument.String(Keys.TotalItems);
      var firstTagDoc = tagDocument.DocumentList(Keys.PageDocuments).FirstOrDefault();

      <li class="card">
        <a class="card__link" href="@Context.GetLink(tagDocument)">
          <div class="card__container">
            <h2 class="card__header">@tagName</h2>
            <p class="card__count">@postCount Posts</p>
            <span class="card__more">View All</span>
          </div>
        </a>
      </li>
    }
  </ul>
  @Html.Partial("_PageFooter", true)
</div>